
function [epsilon]=optimum_epsilon_FSL(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14,X15,X16,X17,X18,X19,Xref,w1,w2,eps,Pref)
% parameters
a=1;
 N=length(X1);
M=19;
epsilon=zeros(1,19);
P=zeros(1,19);

while a==1      % this code is running until recieve to break
 % formol 1 in paper 
 
for m=1:N
  mu(1,m)=exp(-(Euclidean(Xref(1,:),X1(m,:))^2)/eps(1));
  mu(2,m)=exp(-(Euclidean(Xref(2,:),X2(m,:))^2)/eps(2));  
  mu(3,m)=exp(-(Euclidean(Xref(3,:),X3(m,:))^2)/eps(3));  
  mu(4,m)=exp(-(Euclidean(Xref(4,:),X4(m,:))^2)/eps(4));  
  mu(5,m)=exp(-(Euclidean(Xref(5,:),X5(m,:))^2)/eps(5));  
  mu(6,m)=exp(-(Euclidean(Xref(6,:),X6(m,:))^2)/eps(6));  
  mu(7,m)=exp(-(Euclidean(Xref(7,:),X7(m,:))^2)/eps(7));  
  mu(8,m)=exp(-(Euclidean(Xref(8,:),X8(m,:))^2)/eps(8));  
  mu(9,m)=exp(-(Euclidean(Xref(9,:),X9(m,:))^2)/eps(9));  
  mu(10,m)=exp(-(Euclidean(Xref(10,:),X10(m,:))^2)/eps(10));
  mu(11,m)=exp(-(Euclidean(Xref(11,:),X11(m,:))^2)/eps(11)); 
  mu(12,m)=exp(-(Euclidean(Xref(12,:),X12(m,:))^2)/eps(12));
  mu(13,m)=exp(-(Euclidean(Xref(13,:),X13(m,:))^2)/eps(13)); 
  mu(14,m)=exp(-(Euclidean(Xref(14,:),X14(m,:))^2)/eps(14));  
  mu(15,m)=exp(-(Euclidean(Xref(15,:),X15(m,:))^2)/eps(15));  
  mu(16,m)=exp(-(Euclidean(Xref(16,:),X16(m,:))^2)/eps(16));  
  mu(17,m)=exp(-(Euclidean(Xref(17,:),X17(m,:))^2)/eps(17));  
  mu(18,m)=exp(-(Euclidean(Xref(18,:),X18(m,:))^2)/eps(18));  
  mu(19,m)=exp(-(Euclidean(Xref(19,:),X19(m,:))^2)/eps(19));  
end 
 
for n=1:M
   P(n)=(1/(2*(w2(n)-w1(n))))*sum(mu(n,1:end))
end


 for i=1:M
    
     if P(i)>0.045 %& P(i)<0.0599    %for Pref=0.05

     epsilon(i)=eps(i);
     
else
    eps(i)=eps(i)+0.01;
    
 end 
 end
 if epsilon==eps;
 break
 end
end
